// React 核心包
import React from 'react'
// 渲染 React 代码到页面上
import { createRoot } from 'react-dom/client'

/* let wrap = null
let isLoading = true
if (isLoading) {
  wrap = <div>加载中...</div>
} else {
  wrap = <div>加载完毕~~</div>
} */

function fn() {
  /* let isLoading = true
  if (isLoading) {
    return <div>加载中...</div>
  } else {
    return <div>加载完毕~~</div>
  } */

  /* let isLoading = false
  return isLoading ? <div>加载中...</div> : <div>加载完毕~~</div> */

  let isLoading = false
  return <div>{isLoading ? '加载中...' : '加载完毕~~'}</div>
}

// createRoot(渲染到哪儿).render(渲染谁)
createRoot(document.querySelector('#root')).render(fn())
